package com.indusfo.spc.controller;

import com.indusfo.spc.pojo.OrderBadpheno;
import com.indusfo.spc.service.OrderBadphenoService;
import com.indusfo.spc.vo.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * @Author liub
 * @Date 2019/11/25 17:03
 * @Version 1.0
 */

@Controller
@RequestMapping(value = "/service/orderBadpheno")
public class OrderBadphenoController {

    @Autowired
    private OrderBadphenoService orderBadphenoService;

    /**
     * 查询
     */
    @RequestMapping(value = "/queryOrderBadpheno")
    @ResponseBody
    public JSONObject queryOrderBadpheno(OrderBadpheno orderBadpheno) {
        JSONObject json = orderBadphenoService.queryOrderBadpheno(orderBadpheno);
        return json;
    }

    /**
     * 新增
     */
    @RequestMapping(value = "/insertOrderBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject insertOrderBadpheno(OrderBadpheno orderBadpheno) {
        JSONObject json = orderBadphenoService.insertOrderBadpheno(orderBadpheno);
        return json;
    }

    /**
     * 修改
     */
    @RequestMapping(value = "/updateOrderBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject updateOrderBadpheno(OrderBadpheno orderBadpheno) {
        JSONObject json = orderBadphenoService.updateOrderBadpheno(orderBadpheno);
        return json;
    }

    /**
     * 删除
     */
    @RequestMapping(value = "/deleteOrderBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject deleteOrderBadpheno(@RequestParam("orderBadphenoIds") List<Integer> orderBadphenoIds, Integer dataState) {
        dataState = 2;
        JSONObject json = orderBadphenoService.deleteOrderBadpheno(orderBadphenoIds, dataState);
        return json;
    }

    /**
     * 启停
     */
    @RequestMapping(value = "/definedOrderBadpheno", method = RequestMethod.POST)
    @ResponseBody
    public JSONObject definedOrderBadpheno(@RequestParam("orderBadphenoIds") List<Integer> orderBadphenoIds, Integer dataState) {
        JSONObject json = orderBadphenoService.deleteOrderBadpheno(orderBadphenoIds, dataState);
        return json;
    }

}
